package cn.kevinking.ai.mcp.provider.utils;

import lombok.experimental.UtilityClass;
import org.springframework.util.StringUtils;

import java.net.URI;
import java.net.URISyntaxException;

/**
 * @author jinkw
 */
@UtilityClass
public class EnvUtils {
    public static final String SPRING_PROFILE_KEY = "spring.profiles.active";
    public static final String SPRING_DEFAULT_PROFILE = "default";

    public boolean isValidServerUrl(String url) {
        if (!StringUtils.hasText(url)) {
            return false;
        }
        try {
            String protocol = new URI(url).getScheme();
            return "http".equals(protocol) || "https".equals(protocol);
        } catch (URISyntaxException e) {
            return false;
        }
    }
}
